export function formatTimeAgo(timestamp) {
  const now = Date.now();
  const diff = now - timestamp;

  if (diff < 0) {
    return null; // 处理未来时间的情况
  }

  const seconds = Math.floor(diff / 1000);

  if (seconds < 60) {
    return '1分钟';
  }

  const minutes = Math.floor(seconds / 60);
  if (minutes < 60) {
    return `${minutes}分钟`;
  }

  const hours = Math.floor(minutes / 60);
  if (hours < 24) {
    return `${hours}小时`;
  }

  const days = Math.floor(hours / 24);
  if (days < 30) {
    return `${days}天`;
  }

  const months = Math.floor(days / 30);
  if (months < 3) {
    return `${months}个月`;
  } else {
    return null;
  }
}